import bus from "@/bus";
let data = {
  status: 'pass',
  form: {
    name: '',
    departmentArr: [],
    departmentName: '',
    time: [],
    goldNumold: null,
    goldNum: null,
    startTime: '',
    endTime: '',
    isEnable: false
  },
  columns: [{
      title: '奖品名称',
      key: 'name',
      minWidth: 200
    }, {
      title: '配图',
      key: 'imgUrl',
      minWidth: 150,
      align: 'left',
      render: (h, params) => {
        return h('div', {
          class: 'imgs'
        }, [
          h('a', {
            attrs: {
              href: params.row.imgUrl,
              target: '_blank'
            }
          }, [
            h('img', {
              attrs: {
                src: params.row.imgUrl + '_100w'
              }
            })
          ])
        ])
      }
    }, {
      title: '大奖',
      key: 'isGrand',
      minWidth: 150,
      align: 'left',
      render: (h, params) => {
        let className = 'font-blue'
        if (params.row.isGrand) className = 'font-red'
        return h('div', {class: className}, params.row.isGrand ? '是' : '否')
      }
    }, {
      title: '安慰奖',
      key: 'isComfort',
      minWidth: 150,
      align: 'left',
      render: (h, params) => {
        let className = 'font-blue'
        if (params.row.isComfort) className = 'font-red'
        return h('div', {class: className}, params.row.isComfort ? '是' : '否')
      }
    }, {
      title: '奖品类型',
      key: 'prizeTypeEnum',
      minWidth: 150,
      align: 'left',
      render: (h, params) => {
        return h('div', params.row.prizeTypeEnum === 'COUPON' ? '现金券' : '实物')
      }
    }, {
      title: '初始库存',
      key: 'initStock',
      align: 'left',
      minWidth: 150,
      render: (h, params) => {
        return h('div', params.row.isComfort ? '-' : params.row.initStock)
      }
    }, {
      title: '剩余个数',
      key: 'lastStock',
      align: 'right',
      minWidth: 150,
      render: (h, params) => {
        return h('div', params.row.isComfort ? '-' : params.row.lastStock)
      }
    }, {
      title: '已中数量',
      key: 'winNum',
      align: 'right',
      minWidth: 150,
      render: (h, params) => {
        return h('div', params.row.isComfort ? '-' : params.row.winNum)
      }
    }, {
      title: '中奖概率(%)',
      key: 'probability',
      align: 'right',
      minWidth: 150,
      render: (h, params) => {
        return h('div', params.row.isComfort ? '-' : params.row.probability)
      }
    }, {
      title: '操作',
      align: 'right',
      minWidth: 210,
      render: (h, params) => {
        let addBtn = h('Button', {
          class: 'mr',
          props:{
            size:'small',
            type:'primary'
          },
          on: {
            click: () => {
              bus.$emit('onAddStock', params.row.id, params.row.lastStock)
            }
          }
        },'加库存')
        let editBtn = h('Button', {
          class: 'mr',
          props:{
            size:'small',
            type:'primary'
          },
          on: {
            click: () => {
              bus.$emit('onEdit', params.row.id)
            }
          }
        },'编辑')
        let delBtn = h('Button', {
          props:{
            size:'small',
            type: 'warning',
            disabled: !params.row.isComfort
          },
          on: {
            click: () => {
              bus.$emit('onDelete', params.row.id, params.row.name, params.index)
            }
          }
        },'删除')
        return h('div', [addBtn, editBtn, delBtn])
      }
  }],
  data: []
}
export default data;